<template>
  <div>
    <div class="index_box">
      <div class="index_head">
        <div class="head_top">
          <span class="iconfont icon-fangdajing"></span>
          <div class="head_top_test">
            <span
              v-for="(item, i) in dataLists"
              :key="item"
              @click="listJump(i)"
              :class="{ con: index == i }"
              >{{ item }}</span
            >
          </div>
          <span class="iconfont icon-xiangji"></span>
        </div>
        <van-tabs color="transparent" @click="jump" v-show="index == 1">
          <van-tab v-for="item in goodsLists" :title="item" :key="item">
          </van-tab>
        </van-tabs>
      </div>
    </div>
  </div>
</template>

<script>
import bus from "../../api/bus.js";
export default {
  data: function () {
    return {
      num: 0,
      index: 1,
      dataLists: ["关注", "推荐", "直播"],
      goodsLists: [
        "全部",
        "穿搭",
        "滑板",
        "潮流文化",
        "理容",
        "运动健身",
        "潮玩",
        "美妆",
        "潮鞋",
        "数码",
        "手表",
      ],
    };
  },
  methods: {
    // 二级菜单跳转
    jump(name) {
      // console.log(name, title);
      this.num = name;
      bus.$emit("gojump",name);
    },
    // 一级菜单跳转
    listJump(i){
      this.index = i;
      this.$emit("list-jump",i);
    }
  },
};
</script>

<style lang="less">
.index_box {
  width: 100%;
  .index_head {
    width: 100%;
    position: fixed;
    left: 0;
    top: 0;
    min-height: 35px;
    background-color: #fff;
    box-sizing: border-box;
    padding: 10px 20px;
    z-index: 10;
    .head_top {
      width: 100%;
      display: flex;
      justify-content: space-between;
      color: #b0afb6;
      .head_top_test {
        .con {
          font-weight: bold;
          color: #000;
          font-size: 16px;
        }
        span {
          padding: 0 10px;
          font-size: 14px;
        }
      }
      .iconfont {
        color: #000;
        font-size: 18px;
      }
    }
    .van-tabs--line {
      .van-tabs__wrap {
        height: 30px;
        .van-tabs__nav--line {
          padding: 0;
        }
      }
    }
    .van-tab--active {
      font-weight: bold;
    }
  }
}
</style>